<!--************************************************************ -->
<!--* 文件创建日期：2010                                  * -->
<!--* 文件修改日期：			                                   * -->
<!--************************************************************ -->
<!--JSP初始化设置-->
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@page import="com.infomanage.po.*" %>
<%@page import="com.infomanage.vo.*" %>
<%@page import="com.infomanage.service.tech.*"%>
<%  response.addDateHeader("Expires", 0);response.setHeader("Pragma","no-cache"); response.setHeader("Cache-Control","no-cache");%>
<%
	request.setCharacterEncoding("UTF-8");
	String itemId = request.getParameter("itemId");
    if(itemId == null) itemId = "";
    
    TechRescuelogItem item = TechRescueLogService.loadRescueLog(request, response, out);
    int teamLeaderId = -1;
    int deptId = -1;
    int arrivenum = 0;
    String timestamp = "";
    String teamleaderName = "";
    String deptName = "";
    String description = "";
    String detail = "";
    int willArrivenum = 0;
    if(item != null) {
    	TechRescuelog bean = item.getBean();
    	Department dept = item.getDept();
    	Person person = item.getTeamLeader();
    	arrivenum = bean.getArrivenum();
    	deptId = bean.getDeptId();
    	deptName = dept.getPath();
    	description = bean.getDesciption();
    	detail = bean.getDetail();
    	teamLeaderId = bean.getTeamleaderId();
    	timestamp = bean.getTimestamp();
    	willArrivenum = bean.getWillarrivenum();
    	teamleaderName = person.getName();
    } 
%>
<html>
<head>
	<title>矿山救护工作日志</title>
	<META HTTP-EQUIV="Pragma" CONTENT="no-cache">	
	<link href="../../css/table.css" rel="stylesheet" type="text/css">
	<link href="../../css/calendar.css" rel="stylesheet" type="text/css">
	<script type="text/javascript" src="../../js/calendar.js"></script>
	<script type="text/javascript" src="../../js/common.js"></script>
	<script type="text/javascript">
	   function init() {
		   if("" != "<%=itemId%>") { // 修改
		   }
	   }
	   // 提交
	   function doSubmit(){
	   		if(validate()){
	   			return false;
	   		}
		 	if("" == "<%=itemId%>") {
		 		form1.actionType.value = "add";
			}else {
		 		form1.actionType.value = "modify";
			}
		 	form1.submit();
	   }

	   function validate(){
	   		if(form1.timestamp.value == ""){
	   			alert("时期不能为空！");
	   			return true;
	   		}
	   		if(form1.deptId.value == -1){
	   			alert("队别不能为空！");
	   			return true;
	   		}
	   		if(form1.teamLeaderId.value == -1){
	   			alert("队长不能为空！");
	   			return true;
	   		}
	   		
	   		if(isNaN(form1.willArrivenum.value)){
	   			alert("应到人数必须位数字！");
	   			return true;
	   		}
	   		
	   		if(isNaN(form1.arrivenum.value)){
	   			alert("实到人数必须位数字！");
	   			return true;
	   		}

	   		if(form1.detail.value.length > 5000){
   				alert("学习/训练/工作/出动等情况不能超过5000个字！");
   				return true;
	   	    }	   		

	   		if(form1.description.value.length > 5000){
   				alert("备注不能超过5000个字！");
   				return true;
	   	    }	   		
	   		return false;
	   }
	   
	   function showError(error){
		   alert(error);
	   }

	   function showInfo(info){
		   alert(info);
		   window.returnValue = "ok";
		   window.close();
	   }
	</script>
</head>
<body  rightmargin="0" bottommargin="0" leftmargin="0" topmargin="0" onclick="clickBody();" onload="init();">
	<form name="form1" action="ambulance_action.jsp" method="post" target="actionFrame">
	<input type="hidden" name="itemId" value="<%=itemId%>">
	<input type="hidden" name="actionType">
	<table class="dialogTable" cellpadding="0" cellspacing="0">
		<!-- 表头-->
		<tr class="dialogTableHeader">
			<td>矿山救护工作日志</td>
		</tr>
		<!-- 表数据-->
		<tr class="dialogTableContent">
			<td>
				<!-- 数据项 -->
				<table class="dataTable">
					<col width="30%">
					<col width="70%">
					<tr>
						<td class="field">
							日期
						</td>
						<td>
							<input value="<%=timestamp %>" type="text" style="width: 230px;cursor: hand;" name="timestamp" id="timestamp" onClick="return showCalendar(this.id, 'y-mm-dd');" readonly="readonly"><img 
									src="../../img/tip_calender.gif" style="cursor: hand;" width="16" height="16" onClick="return showCalendar('timestamp', 'y-mm-dd');">
						</td>
					</tr>
					<tr>
						<td class="field">
							队别
						</td>
						<td>
							<span class="treeSpan" onclick="showTree(this, '../common/deptTree.jsp');" treeSelect="true" treeType="0">
								<input value="<%=deptName %>" name="deptname" value="" style="width: 302px;" 
								readonly="readonly" treeSelect="true"><input name="deptId" value="<%=deptId %>" type="hidden">
							</span>
						</td>
					</tr>
					<tr>
						<td class="field">
							队长
						</td>
						<td>
							<span class="treeSpan" onclick="showTree(this, '../common/personTree.jsp');" treeSelect="true" treeType="1">
								<input name="teamleaderName" value="<%=teamleaderName %>"  nodeId="" id="deptTreeInput" value="" 
									style="width: 302px;" readonly="readonly" 
									treeSelect="true"><input name="teamLeaderId" value="<%=teamLeaderId %>" type="hidden">
							</span>
						</td>
					</tr>
					<tr>
						<td  class="field">
							应到人数
						</td>
						<td>
							<input value="<%=willArrivenum %>" type="text" name="willArrivenum"  style="width:100%;">
						</td>
					</tr>
					<tr>
						<td class="field">
							实到人数
						</td>
						<td>
							<input value="<%=arrivenum %>" type="text" name="arrivenum" style="width:100%;">
						</td>
					</tr>
					<tr>
						<td class="field" height="120px">
							学习/训练/工作/出动等情况
						</td>
						<td>
							<textarea style="width: 100%;height:100%;" name="detail"><%=detail %></textarea>
						</td>
					</tr>
					<tr >
						<td class="field" height="70px">
							备注
						</td>
						<td>
							<textarea style="width: 100%;height:100%;" name="description"><%=description %></textarea>
						</td>
					</tr>
				</table>
			</td>
		</tr>
		<tr>
			<td colspan="2" class="tableBtn">
				<span onclick="doSubmit();">确定</span>
				<span onclick="window.close();">取消</span>
			</td>
		</tr>
		<tr valign="top">
			<td colspan="2">
				&nbsp;
			</td>
		</tr>
	</table>
	</form>
	<iframe src="#" frameborder="0" id="treeFrame" name="frame" style="display: none;position: absolute;"></iframe>
	<iframe src="#" name="actionFrame" style="display: none;"></iframe>
</body>
</html>